package com.abocode.aichat.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by guanxf on 2015/8/13.
 */
public class DateUtils {
    //定义时间格式 begin
    /**
     * -使用_代替
     */
    public static final String FORMAT_FOR_yyyy_MM_dd ="yyyy-MM-dd";
    // 各种时间格式
    public static final String FORMAT_FOR_yyyyMMdd ="yyyyMMdd";
    // 各种时间格式
    public static final String FORMAT_FOR_yyyyMMdd_Chinese ="yyyy年MM月dd日";
    public static final String FORMAT_FOR_yyyy_MM_dd_HH_mm ="yyyy-MM-dd HH:mm";
    public static final String FORMAT_FOR_yyyymmddhhmmss ="yyyyMMddHHmmss";
    public static final String FORMAT_FOR_HH_mm ="HH:mm";
    public static final  String FORMAT_FOR_yyyy_MM_dd_HH_mm_ss="yyyy-MM-dd HH:mm:ss";

    //定义时间格式 end

    public static String getCurrentDate(String format) {
        Date date=new Date();
        if (null == date) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }

    public static void main(String[] args) {
       String str= DateUtils.getCurrentDate(DateUtils.FORMAT_FOR_yyyyMMdd_Chinese);
        System.out.print(str);
    }
}
